package com.liyuncong.learn.learnberkeleydb;

import com.sleepycat.je.DatabaseException;

public interface BerkeleydbDao<T> {
	/**
	 * open database
	 * @throws DatabaseException 
	 */
	public void openConnection(String filePath, String databaseName) throws DatabaseException;

	/**
	 * 关闭数据库
	 * @throws DatabaseException 
	 */
	public void closeConnection() throws DatabaseException;

	/**
	 * insert
	 * @throws DatabaseException 
	 */
	public void save(String name, T t) throws DatabaseException;

	/**
	 * delete
	 * @throws DatabaseException 
	 */
	public void delete(String name) throws DatabaseException;

	/**
	 * update
	 * @throws DatabaseException 
	 * 
	 */
	public void update(String name, T t) throws DatabaseException;

	/**
	 * select
	 * @throws DatabaseException 
	 */
	public T get(String name) throws DatabaseException;
}
